// run: $exec < input
#include <iostream>

int const maxn = 5007;
long long a[maxn][maxn];
long long s1[maxn], s2[maxn];
int n;

bool inrange(int x, int y)
{
	return 0 <= x && x < n && 0 <= y && y < n;
}

int main()
{
	std::ios::sync_with_stdio(false);
	std::cin >> n;
	for (int i = 0; i < n; i++)
		for (int j = 0; j < n; j++) std::cin >> a[i][j];

	for (int i = 0; i < 2 * n - 1; i++) {
		int x = 0, y = i;
		if (y >= n) { x = y - n + 1; y = n - 1; }
		for (; inrange(x, y); x++, y--) s1[i] += a[x][y];
	}

	for (int i = 0; i < 2 * n - 1; i++) {
		int x = n - 1, y = i;
		if (y >= n) { x = n - 1 - (y - n + 1); y = n - 1; }
		for (; inrange(x, y); x--, y--) s2[i] += a[x][y];
	}

	long long ans[2] = {0, 0};
	int x[2], y[2];
	for (int i = 0; i < n; i++)
		for (int j = 0; j < n; j++) {
			int t = (i + j) & 1;
			long long tmp = s1[i + j] + s2[j - i + n - 1] - a[i][j];
			if (tmp >= ans[t]) {
				ans[t] = tmp;
				x[t] = i; y[t] = j;
			}
		}
	std::cout << ans[0] + ans[1] << '\n';
	std::cout << x[0] + 1 << ' ' << y[0] + 1 << ' ' << x[1] + 1 << ' ' << y[1] + 1 << '\n';
}

